﻿using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace NBuild.Fx.Engine
{
    public sealed class PropertyOverride
    {
        private readonly string _name;
        private readonly string _value;

        public PropertyOverride(string name, string value)
        {
            _name = name;
            _value = value;
        }

        public string Name
        {
            get { return _name; }
        }

        public string Value
        {
            get { return _value; }
        }
    }

    public sealed class PropertyOverrideCollection : KeyedCollection<string, PropertyOverride>
    {
        public void AddRange(IEnumerable<PropertyOverride> propertyOverrides)
        {
            foreach (var propertyOverride in propertyOverrides)
                Add(propertyOverride);
        }

        protected override string GetKeyForItem(PropertyOverride item)
        {
            return item.Name;
        }
    }
}
